08_01 Modifying the Cart

Modifying Cart

We're pretty much done moving items around, so let's focus on adding some functionality.


Practice

  1. Move cartTotal to App.vue
  2. Create new addItem method
  3. Create cartQty
    computed properties
  4. Update files to display cart.

For this practice, we'll modify our cart so that we can calculate the items in a better way. Right now we get a simple list of items in the cart, but it'd be better to organize them by item.

We'll move cartTottal to App.vue so prepare for this.

I'm going to rename the addToCart method to addItem and I'll rewrite it to filter by items.

I'll also create a computed property to calculate how many items are in the cart.

Finally, I'll modify the files to display the new version of the cart.